/// @tags:
#include <cstdio>
#include <functional>
#include <iostream>
#include <numeric>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

constexpr int maxn = 100;

int a[maxn], b[maxn];

bool chk[maxn];

bool val[maxn << 2], lazy[maxn << 2];

void build(int cur, int l, int r) {
  if (l == r) {
    val[cur] = true;
    return;
  }
  int ls = cur << 1, rs = cur << 1 | 1, mid = (l + r) >> 1;
  build(ls, l, mid);
  build(rs, mid + 1, r);
}

inline void push_down(int cur, int l, int r) {
  int mid = (l + r) >> 1, ls = cur << 1, rs = cur << 1 | 1;
  if (lazy[cur] != -1) {
    lazy[ls] = lazy[cur];
    val[ls] = lazy[cur];
    lazy[rs] = lazy[cur];
    val[rs] = lazy[cur];
    lazy[cur] = -1;
  }
}

void modify(int cur, int l, int r, int L, int R, bool mod) {
  if (L <= l && r <= R) {
    val[cur] = mod;
    lazy[cur] = mod;
    return;
  }
  push_down(cur, l, r);
  int mid = (l + r) >> 1;
  if (L <= mid) modify(cur << 1, l, mid, L, R, mod);
  if (R > mid) modify(cur << 1 | 1, mid + 1, r, L, R, mod);
}

bool query(int cur, int l, int r, int pos) {
  if (l == r) return val[cur];
  int mid = (l + r) >> 1;
  push_down(cur, l, r);
  if (pos <= mid) return query(cur << 1, l, mid, pos);
  if (mid < pos) return query(cur << 1 | 1, mid + 1, r, pos);
}

int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
      chk[i] = false;
      cin >> a[i];
    }
    for (int i = 1; i <= n; ++i) {
      cin >> b[i];
    }
    int lim1 = n, lim2 = 1;
    for (int i = 1; i <= n; ++i) {
      if (a[i] > b[i]) {
        modify(1, 1, n, b[i], a[i] - 1, false);
        modify(1, 1, n, b[i] / 2, a[i] / 2, false);
        modify(1, 1, n, 1, a[i] - b[i], false);
      }
    }
    for (int i = 1; i <= n; ++i) {
      cout << i << ' ';
    }
    cout << '\n';
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("E. Game of the Year.in", "r", stdin);
  freopen("E. Game of the Year.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
